package com.ocom.accesservice.controller;

import com.alibaba.fastjson.JSONObject;
import com.ocom.accesservice.service.MjYkmService;
import com.ocom.accesservice.service.MjYkmVoService;
import com.ocom.accesservice.vo.PersonnelYkmVo;
import com.ocom.common.constant.AccessServiceUrl;
import com.ocom.common.enums.ResultEnum;
import com.ocom.common.resp.Result;
import com.ocom.common.utils.ResultUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class YkmVoController {

    @Autowired
    private MjYkmVoService mjYkmService;

    @PostMapping(AccessServiceUrl.URL_GetYkmPersonnelSum)
    public Result getYkmPersonnelSum(@RequestBody JSONObject jsonObject){
        PersonnelYkmVo personnelYkmVo=mjYkmService.selectGetYkmPersonnelSum(jsonObject.getLong("comId"),jsonObject.getString("deptIds"));
        if (personnelYkmVo==null){
            return ResultUtil.error(ResultEnum.Err_1001);
        }
        return ResultUtil.success(personnelYkmVo);
    }
}
